# define all output targets the target "all" is the goal when invoking make with
# ~make all~ or ~make~.
all: list.md list.texi list.html

# Define .exported as intermediate target - This will cause ~make all~ to only
# do anything, if the output files do not yet exist. -- (Why does it cause
# that?)

# For now I comment this out, because one would have to delete the previously
# exported files, to produce new exported files, if .exported is defined as
# intermediate target.

# .INTERMEDIATE: .exported

# All output files depend on .exported, which is another target.
list.md list.texi list.html: .exported

# .exported depends on the actual org file source and the command will produce
# all output files, which are all targets
.exported: list.org
	HOME=$$(dirname $$(realpath "$<")) \
	emacs \
	--quick \
	--batch \
	"$<" \
	--exec "(require 'ox-md)" \
	--funcall org-md-export-to-markdown \
	--funcall org-html-export-to-html \
	--funcall org-texinfo-export-to-texinfo \
	--funcall kill-emacs
